﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SavoryBL;

namespace WebApplication.ManageAccount
{
    public partial class Change_Password : System.Web.UI.Page
    {
        SavoryUserDetails userDtlsObj = new SavoryUserDetails();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserID"] != null && Session["UserID"].ToString() != "Guest")
                ((System.Web.UI.HtmlControls.HtmlGenericControl)Master.FindControl("divbreadcrum")).InnerHtml = @"<a href='../Menu.aspx'>Home</a> > <a href='Account_Overview.aspx'>My Account Overview</a> > <span>Change Password</span>";
            else
                ((System.Web.UI.HtmlControls.HtmlGenericControl)Master.FindControl("divbreadcrum")).InnerHtml = @"<a href='../default.aspx'>Home</a> > <a href='Account_Overview.aspx'>My Account Overview</a> > <span>Change Password</span>";
        }

        protected void btn_Update_Click(object sender, EventArgs e)
        {
            try
            {
                if (Session["UserID"] != null && Session["UserID"].ToString() != "")
                {

                    ResponseStatus status = ResponseStatus.Failure;
                    status = userDtlsObj.UserChangePassword(Convert.ToInt32(Session["ID"].ToString()), txt_OldPassword.Text.Trim(), txt_NewPassword.Text.Trim());
                    if (status == ResponseStatus.Success)
                    {
                        div_UpdatePwdMsg.Style["display"] = "block";
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
    }
}